﻿using MapDownloader.Core.Core;
using MapDownloader.Core.MapProviders;
using MapDownloader.Core.Storage;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;

namespace MapDownLoaderWeb
{
   public class Program
   {
      public static void Main(string[] args)
      {
         Maps.Instance.Provider = BaiduMapProvider.Instance;
         //GaoDeProvider.Instance.Storager.SetConnectionString("Server=120.79.8.161;Database=WisdomHome1;Uid=wisdonhome;Pwd=1q2w3e4r;Character Set=utf8;Port=3306;SslMode=none");
         Maps.Instance.Provider.Storager = new MongoTileStorage();
         Maps.Instance.Provider.Storager.SetConnectionString("mongodb://127.0.0.1:27017/?safe=true", null);
         Maps.Instance.UserProvider = false;
         Maps.Instance.UseSaveToDb = true;
         CreateWebHostBuilder(args).Build().Run();
      }

      public static IWebHostBuilder CreateWebHostBuilder(string[] args)
      {
         return WebHost.CreateDefaultBuilder(args)
            .UseUrls("http://*:8111")
            .UseStartup<Startup>();
      }
   }
}